Skip to content

[MRG] Fix sparse simplex projection with oversized budgets - #876

Open
AHMETHAKANBEZIR1 wants to merge 10 commits into
PythonOT:masterfrom
AHMETHAKANBEZIR1:fix/sparse-simplex-oversized-budget
Open

AHMETHAKANBEZIR1 wants to merge 10 commits into
PythonOT:masterfrom
AHMETHAKANBEZIR1:fix/sparse-simplex-oversized-budget

Conversation

@AHMETHAKANBEZIR1

@AHMETHAKANBEZIR1 AHMETHAKANBEZIR1 commented Oct 2, 2026 •

Copy link
Copy Markdown

Types of changes

Bug fix, analytic regression tests and release note.

Motivation and context / Related issue

Fixes #875. An oversized max_nz in projection_sparse_simplex previously creates threshold indices longer than the projected row and raises a broadcasting error. When the budget is at least the projected dimension, use the existing ordinary simplex projection directly, as the documented contract requires. All axis modes inherit this through their existing recursion; smaller sparsity budgets retain their existing path. The fallback avoids indexed mutation on TensorFlow tensors.

How has this been tested

Current head 19847cb includes master f48a63a. Only RELEASES.md conflicted; both release entries are retained. The PR production and regression files are byte-for-byte unchanged from its previous head.

  • Complete utility module and doctests: NumPy 127 passed, 1 skipped; NumPy/PyTorch 2.9.1 CPU 193 passed, 1 skipped; NumPy/TensorFlow 161 passed, 33 skipped. Each process asserts the actual backend list and source checkout. Torch and TensorFlow run in separate environments. Skips are reported, not counted as passes.

  • The updated master's native extensions were rebuilt locally with the existing MSVC/Cython toolchain; the results above were repeated against that build. No native solver correctness or performance claim follows from the utility tests.

  • All applicable configured pre-commit hooks for the PR files and diff checks pass.

  • A private integration of [MRG] Fix sparse simplex projection with oversized budgets #876, [MRG] Handle both endpoints in sample-ratio splitting #878 and [MRG] Stabilize simplex projection against large common offsets #880 on the same master passes the utility module/doctests: NumPy 145 passed, 1 skipped; NumPy/PyTorch 229 passed, 1 skipped; NumPy/TensorFlow 197 passed, 33 skipped. That local integration branch is not published and is not part of this PR.

Windows/Python 3.12.14, CPU only. The full package suite, current full documentation/gallery, GPU, JAX and CuPy were not run locally. Current-head CircleCI documentation build 4315 completed successfully, with its commit verified against this PR head; all three reported checks now pass. This is an upstream full documentation build, not a local gallery run.

PR checklist

  • I have read CONTRIBUTING.

  • Full current documentation build: upstream CircleCI 4315 passed; not run locally.

  • Full package suite: utility coverage above only.

  • Added the fix to RELEASES.md.

AI assistance disclosure

Prepared, investigated and tested autonomously by OpenAI Codex on behalf of AHMETHAKANBEZIR1. No independent human review has been performed.

15 November 2026 update (66c0ebb). Merged master 3367480 and resolved the RELEASES.md conflict by keeping both entries. The PR's implementation and regression tests are unchanged. The utility and circle-solver test modules passed on Windows CPU (144 NumPy tests and 221 NumPy/PyTorch tests). The new CircleCI documentation checks are pending at the time of this update.

Cap the effective row budget at its width, preserving the documented
equivalence to the unconstrained projection. Add an analytic regression
for exact and oversized budgets across all supported axis modes.

Co-authored-by: Codex <noreply@openai.com>
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.54%. Comparing base (604c47f) to head (61e13ba).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #876      +/-   ##
==========================================
- Coverage   97.00%   95.54%   -1.46%     
==========================================
  Files         128      128              
  Lines       26349    26365      +16     
==========================================
- Hits        25559    25191     -368     
- Misses        790     1174     +384     
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

projection_sparse_simplex fails when max_nz exceeds the projected dimension

1 participant